package com.hngs.dto;

import lombok.Data;

@Data
public class ResponseDto {
    /**
     * code : 0 成功
     * message：当成功得时候不做任何响应 失败得时候把对应失败信息给反馈出来
     * date:[{json串得实际响应数据}]
     */
    private int code;
    private String message;
    private Object Data;

    //如果响应成功
    public static ResponseDto success(Object data){
        ResponseDto dto=new ResponseDto();
        dto.setCode(0);
        dto.setData(data);
        return dto;
    }
    //如果失败
    public static ResponseDto error(int code,String message){
        ResponseDto dto=new ResponseDto();
        dto.setCode(code);
        dto.setMessage(message);
        return dto;
    }

}
